<?php
foreach($technologies as $technology){
	$tecstatus=$technology['CompTechnology']['status'];
	$creater=$technology['CompTechnology']['creater'];
}
$companyid=$session->read("companyid");
$user=$session->read('User');
$isflag=$action->checkPermissions($user,"confirm");
?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
		<h2>
		<?php
		$companyname=$session->read("companyname");
		echo $html->link($companyname,"/companys/showinfosummary/".$companyid);
		?>
		</h2>
		<div class="clear"></div>
	</div>
	<?php
	if(classregistry::init('User')->personAuthority($user)){
		echo '<div class="right item_add_btn">';
		echo $html->link(__('添加',true), 'edittechnology');
		echo '</div>';
	}
	//else{
	//	echo '<div class="right enableaction">';
	//	echo "<a>添加</a>";
	//echo '</div>';
	//}
	?>
	<?php
	if($showpage==1)
	{
		if(isset($paging)){ echo $this->renderElement('pagination',$paging);}
	}
	?>
	<div class="clear"></div>
	<div class="right_sidt_head_screen">
		<div class="left">
			<div class="right_side_head_line">
				<ul>
					<li>
						<div class="left screen_condition">
						<?php echo $html->link("总立项数","/companys/technology/")?>
							：
						</div>
						<div class="left screen_counts">
						<?php echo $urlcount?>
							个
						</div>
						<div class="clear"></div>
					</li>
					<?php
					foreach($technologytype as $key=>$ptype){
						$selected="";
						if(!empty($_GET['ptype'])){
							if($key==$_GET['ptype']){
								$selected="selected";
							}
						}
						?>
					<li class="<?php echo $selected?>">
						<div class="left screen_condition">
						<?php echo $html->link($technologyname[$key],"/companys/technology?ptype=".$key)?>
							：
						</div>
						<div class="left screen_counts">
						<?php echo $ptype;?>
							个
						</div>
						<div class="clear"></div>
					</li>
					<?php }?>
					<div class="clear"></div>
				</ul>
			</div>
			<div class="right_side_head_line">
				<ul>
				<?php foreach($technologystate as $key=>$tstate){
					$selected="";
					if(isset($_GET['state'])){
						if($key==$_GET['state']){
							$selected="selected";
						}
					}
					$indexstr=$str->getstausstr($key);
					?>
					<li class="<?php echo $selected?>">
						<div class="left screen_condition">
						<?php echo $html->link($indexstr,"/companys/technology?state=".$key)?>
							：
						</div>
						<div class="left screen_counts">
						<?php echo $tstate?>
							个
						</div>
						<div class="clear"></div>
					</li>
					<?php }?>
					<div class="clear"></div>
				</ul>
			</div>
		</div>
		<div class="right display_by_year_btn" style="display: none">
		<?php echo $html->link('按年份显示',"/companys/timetechnology/",null,null); ?>
		</div>
		<div class="clear"></div>
	</div>
</div>
<div class="right_side_scollbar">
	<div class="detail_info_panel">
		<div class="items_list" id='panel'>
			<table>
				<tr>
					<th>项目名称</th>
					<th>立项类型</th>
					<th>主管部门</th>
					<!--                    <th>申报状态</th>-->
					<!--                    <th>立项状态</th>-->
					<!--                    <th>审核状态</th>-->
					<!--                    <th>时间</th>-->
					<th><?php __("Action")?></th>
				</tr>
				<?php
				foreach($technologies as $technology){
					$id=$technology["CompTechnology"]["id"];
					echo "<tr class='per_list'>";
					echo "<td>".$html->link($technology['CompTechnology']['tname'],"/companys/showtechnology/".$id)."</td>";
					//echo "<td>".$technology['type_id']['name']."</td>";
					$status=$technology["CompTechnology"]["state"];
					echo "<td>".$str->getkeystr($technology['CompTechnology']['type_id'],$types)."</td>";
					echo "<td>".$str->getkeystr($technology['CompTechnology']['department'],$talstacktype)."</td>";
					//					echo "<td>".$str->getkeystr($technology['CompTechnology']['declarate_status'],$dstatus)."</td>";
					//					$apply_time=$technology["CompTechnology"]["apply_time"];
					//					$accept_time=$technology["CompTechnology"]["accept_time"];
					//					$authorize_time=$technology["CompTechnology"]["authorize_time"];
					//					echo "<td>".$str->getstaus($status)."</td>";
					//					echo "<td>".$str->getisflag($technology['CompTechnology']['status'])."</td>";
					//					echo "<td>".$str->getstaustime($status, $apply_time, $accept_time, $authorize_time)."</td>";
					echo "<td>";
						
					$company=classregistry::init('Company')->findById($companyid);
					if($tecstatus=="1"){
						if((($creater==$user['id'])||($isflag))&&classregistry::init('User')->personAuthority($user)&&classregistry::init('Company')->personAuthority($company)){
							echo $html->link(__("Edit",true),"/companys/edittechnology/".$id,null,null);
							echo $html->link(__("Delete",true),"/companys/deltechnology/".$id,array("onclick"=>"return doaction(this)"));
						}else{
							echo "<span class='enableaction'>编辑</span>";
							echo "<span class='enableaction'>删除</span>";
						}
					}else{
						if(classregistry::init('Company')->personAuthority($company)){
							echo $html->link(__("Edit",true),"/companys/edittechnology/".$id,null,null);
							echo $html->link(__("Delete",true),"/companys/deltechnology/".$id,array("onclick"=>"return doaction(this)"));
						}else{
							echo "<span class='enableaction'>编辑</span>";
							echo "<span class='enableaction'>删除</span>";
						}
					}
					echo "</td>";
					echo "</tr>";
				}?>
			</table>
		</div>
	</div>
</div>
				<?php echo $this->element('actionconfirm',array("title"=>"删除提示","message"=>"你确定要删除吗？")) ?>
